<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path = request.getContextPath();%>
<style>
    #hide{
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        position: fixed;
        background-image: url("<%=path%>/static/web/css/img/overlay.png");
        opacity: 1;
        z-index: 100;
        display: none;
    }
    #hide #mes{
        margin: 0;
        padding: 0;
        width: 40%;
        height: 45%;
        position: absolute;
        left: 30%;
        top: 15%;
        z-index: 120;
        border: #3a3a3a 8px solid;
        background-color: #cccccc;
        overflow: auto;
    }
    #hide #mes #header{
        margin: 0;
        padding: 0;
        background-color:#019875;
        height: 50px;
        z-index: 150;
        color: white;
    }
    #hide #mes #header #but{
        position: relative;
        background-image: url("<%=path%>/static/web/css/img/controls.png");
        width: 30px;
        height: 30px;
        float: right;
        border:#019875 0px solid;
    }
    #hide #mes #header #but:hover{
        cursor: pointer;
    }
    #hide #mes #header #tit{
        font-size: 25px;

    }
    #hide #mes div {
        text-align: center;
        margin-top: 10px;
        padding: 0;
        height: 50px;
        z-index: 150;
        color: #0C0C0C;
        font-size: 20px;
    }
    #hide #mes #ok{
        margin-top: 40px;
    }
    #hide #mes #ok input:hover{
        cursor: pointer;
        color: #019875;
    }
</style>
<style>
    #hideing{
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        position: fixed;
        background-image: url("<%=path%>/static/web/css/img/overlay.png");
        opacity: 1;
        z-index: 100;
        display: none;
    }
    #hideing #mesg{
        margin: 0;
        padding: 0;
        width: 40%;
        height: 40%;
        position: absolute;
        left: 30%;
        top: 15%;
        z-index: 120;
        border: #3a3a3a 8px solid;
        background-color: #cccccc;
        overflow: auto;
    }
    #hideing #mesg #headers{
        margin: 0;
        padding: 0;
        background-color:#019875;
        height: 50px;
        z-index: 150;
        color: white;
    }
    #hideing #mesg #headers #butt{
        position: relative;
        background-image: url("<%=path%>/static/web/css/img/controls.png");
        width: 30px;
        height: 30px;
        float: right;
        border:#019875 0px solid;
    }
    #hideing #mesg #headers #butt:hover{
        cursor: pointer;
    }
    #hideing #mesg #headers #sub{
        font-size: 25px;

    }
    #hideing #mesg div {
        text-align: center;
        margin-top: 10px;
        padding: 0;
        height: 50px;
        z-index: 150;
        color: #0C0C0C;
        font-size: 20px;
    }
    #hideing #mesg #oks{
        margin-top: 40px;
    }
    #hideing #mesg #oks input:hover{
        cursor: pointer;
        color: #019875;
    }
</style>
<div id="hide">
    <div id="mes">
        <div id="header">
            <span id="tit">修改</span>
            <button id="but"></button>
        </div>
        <div id="like">
            <span>省份名称:&nbsp;</span>
            <input type="text" id="setUp">
        </div>
        <div id="ok">
            <span style="margin-left: 10px">
                <input type="button" id="button" style="font-size: 20px" value="确定">
            </span>
        </div>
    </div>
</div>
<div id="hideing">
    <div id="mesg">
        <div id="headers">
            <span id="sub">添加省份</span>
            <button id="butt"></button>
        </div>
        <div id="likes">
            <span>省份名称:&nbsp;</span>
            <input type="text" id="addAddress">
        </div>
        <div id="oks">
            <span style="margin-left: 10px">
                <input type="button" id="buttons" style="font-size: 20px" value="确定">
            </span>
        </div>
    </div>
</div>
<jsp:include page="/manage/inc/header"/>
<jsp:include page="/manage/inc/menu"/>
<style>
    table tr{
        text-align: center;
    }
</style>
<script>
    $(function () {
        var pageNumber = 1;
        var provinceName = null;
        initdata(pageNumber,provinceName);
        //搜索
        $("#search").click(function () {
            provinceName = $("#provinceName").val();
            initdata(pageNumber,provinceName);
        });
        //分页
        $(".result-content").on("click",".list-page a",function () {
            pageNumber = $(this).data("pagenum");
            initdata(pageNumber,provinceName);
        });
        //修改
        $("#but").click(function () {
            $("#hide").css("display","none");
        });
        var id = "";
        $(".result-content").on("click","td .link-update",function () {
            var name = $(this).parent().prev().prev().prev().html();
            $("#setUp").val(name);
            id = $(this).attr("id");
            $("#hide").css("display","block");
        });
        $("#button").click(function () {
            var name = $("#setUp").val();
            $.get("<%=path%>/manage/address/updataProvinceName",{id:id,provinceName:name},function () {
                $("#hide").css("display","block");
                location.reload();
            });
        });
        //添加
        $("#butt").click(function () {
            $("#hideing").css("display","none");
        });
        $("#addProvince").click(function () {
            $("#hideing").css("display","block");
        });
        $("#buttons").click(function () {
            var name = $("#addAddress").val();
            $.get("<%=path%>/manage/address/addProvince",{provinceName:name},function () {
                location.reload();
            });
        });
    });

    function initdata(pageNumber,provinceName) {
        $.get("<%=path%>/manage/address/date",{pageNumber:pageNumber,provinceName:provinceName},function (resource) {
            $(".result-content").html(resource);
        });
    }
</script>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="<%=path%>/manage/index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">地址管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                    <table class="search-tab">
                        <tr>
                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="provinceName" id="provinceName" type="text"></td>
                            <td><input class="btn btn-primary btn2" id="search" type="submit"></td>
                        </tr>
                    </table>
            </div>
        </div>
        <div class="result-wrap">

                <div class="result-title">
                    <div class="result-list">
                        <a href="#" id="addProvince"><i class="icon-font"></i>新增省份</a>
                    </div>
                </div>
                <div class="result-content">

                </div>

        </div>
    </div>
    <!--/main-->
</div>
<jsp:include page="/manage/inc/footer"/>
